import requests
import json

def newStrategyTracks(payload_dict):
    url = "http://106.53.146.53:7001/api/ccSmartStrategy/saveStrategyTracksForTag/invoke"
    headers = {
        'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
    }
    response = requests.post(url, json=payload_dict, headers=headers)
    print("Status:", response.status_code)
    try:
        span_id = response.json().get("data", {}).get("spanId", "")
        print(f"\"{span_id}\",")
        return span_id
    except:
        print("解析失败")
        return None

# 主函数
if __name__ == "__main__":
    tags = ["杀戮高峰会"]
    payload = [
        {
            "tagNames": tag,
            "score": "8",
            "category": "电影",
            "tagCombin": "评分+标签+分类"
        }
        for tag in tags
    ]

    # 打印 JSON 格式（双引号）
    print(json.dumps(payload, ensure_ascii=False, indent=2))

    # 调用接口
    newStrategyTracks(payload)